﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;

using KCL.Code.Data;

namespace KCL.Code.Business
{
    public class OrderDebtServices
    {
        public static List<OrderDebtView> GetOrderDebtViews()
        {
            return (new OrderDebtDAO()).GetOrderDebtViews();
        }

        public static bool Insert(OrderDebt od)
        {
            if ((new OrderDebtDAO()).Insert(od))
            {
                OrderDAO orderDAO = new OrderDAO();
                orderDAO.UpdateRemain(od.orderCode);
                return true;
            }
            return false;
        }

        public static bool Update(OrderDebt od)
        {
            if ((new OrderDebtDAO()).Update(od))
            {
                OrderDAO orderDAO = new OrderDAO();
                orderDAO.UpdateRemain(od.orderCode);
                return true;
            }
            return false;
        }

        public static bool Delete(OrderDebt od)
        {
            if ((new OrderDebtDAO()).Delete(od))
            {
                OrderDAO orderDAO = new OrderDAO();
                orderDAO.UpdateRemain(od.orderCode);
                return true;
            }
            return false;
        }
    }
}